package com.houseman.workFlow.processer.impl;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.houseman.workFlow.processer.Processer;
import com.houseman.workFlow.service.WorkFlowService;
import com.houseman.workFlow.service.impl.WorkFlowServiceImpl;

/**
 * 关闭流程
 */
public class CloseProcesser extends Processer{

	//service
	WorkFlowService service = new WorkFlowServiceImpl();
		
	@Override
	public void proccess(HttpServletRequest request, HttpServletResponse response) {
		String workId = request.getParameter("workId");
		
		try {
			if(workId != null && !"".equals(workId)) {
				service.closeWorkFlow(new Integer(workId));
				outInfo = closeWin;
			}
			
		} catch (Exception e) {
			outInfo = errorInfo;
			e.printStackTrace();
		}
		
		
		/**
		 * 执行后返回信息
		 */
		try {
			response.setCharacterEncoding("gbk");
			
			PrintWriter out = response.getWriter();
			out.write(outInfo);
			out.flush();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
